<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"
                xmlns:pe="http://primefaces.org/ui/extensions"
                xmlns:ca="http://java.sun.com/jsf/composite/cashier">


    <ui:define name="content">

        <h:panelGroup rendered="true" >
            <h:form>
                <h:outputStylesheet library="css" name="printing.css"></h:outputStylesheet>
                <p:panel id="billFeeReport"  header="Channel Total By Fee Type">
                    <h:panelGrid columns="2" styleClass="noPrintButton"> 
                        <h:outputLabel value="From Date"/>
                        <p:calendar id="frmDate" value="#{channelReportController.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>

                        <h:outputLabel value="To Date"/>
                        <p:calendar id="toDate" value="#{channelReportController.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>
                        </h:panelGrid> 
                    <h:panelGrid columns="4" styleClass="noPrintButton">
                        <p:spacer width="70" height="1"/>
                        <p:commandButton ajax="false" id="btnRefresh" value="Process" action="#{channelReportController.createChannelFees()}">

                        </p:commandButton>
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;" >
                            <p:printer target="reportPrint"  />
                        </p:commandButton>
                        <p:commandButton actionListener="#{channelReportController.createChannelFees()}" ajax="false" value="Excel" styleClass="noPrintButton" style="float: right;" >
                            <pe:exporter type="xlsx" target="tbl2" fileName="hr_report_department"  />
                        </p:commandButton>
                    </h:panelGrid>

                    <p:panel id="reportPrint">
                        <p:dataTable value="#{channelReportController.valueList}" var="s" id="tbl2" >
                            <f:facet name="header" >
                                <p:outputLabel value="Income By Feetype By Session Date" />
                                    <h:outputLabel value="From : " style=" white-space:pre-line;"/>
                                    <h:outputLabel  value="#{channelReportController.fromDate}" >
                                        <f:convertDateTime pattern="dd MMM yyyy HH:mm a"/>
                                    </h:outputLabel>                          
                                    <h:outputLabel value="&emsp;&emsp;To :"/>
                                    <h:outputLabel  value="#{channelReportController.toDate}" >
                                        <f:convertDateTime pattern="dd MMM yyyy HH:mm a"/>
                                    </h:outputLabel>
                            </f:facet>
                            <p:column>
                                <f:facet name="header" >
                                    <p:outputLabel value="Fee Type" />
                                </f:facet>
                                <p:outputLabel value="#{s.string}" />
                                <f:facet name="footer" >
                                    <p:outputLabel value="Total" />
                                </f:facet>
                            </p:column>
                            <p:column style="text-align: right;" >
                                <f:facet name="header" >
                                    <p:outputLabel value="Billd Total" />
                                </f:facet>
                                <p:outputLabel value="#{s.value1}" >
                                    <f:convertNumber parent="#,##,###.00" />
                                </p:outputLabel>
                                <f:facet name="footer" >
                                    <p:outputLabel value="#{channelReportController.totalBilled}" >
                                        <f:convertNumber parent="#,##,###.00" />
                                    </p:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column style="text-align: right;" >
                                <f:facet name="header" >
                                    <p:outputLabel value="Canceled Total" />
                                </f:facet>
                                <p:outputLabel value="#{s.value2}" >
                                    <f:convertNumber parent="#,##,###.00" />
                                </p:outputLabel>
                                <f:facet name="footer" >
                                    <p:outputLabel value="#{channelReportController.totalCancel}" >
                                        <f:convertNumber parent="#,##,###.00" />
                                    </p:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column style="text-align: right;" >
                                <f:facet name="header" >
                                    <p:outputLabel value="Refund Total" />
                                </f:facet>
                                <p:outputLabel value="#{s.value3}" >
                                    <f:convertNumber parent="#,##,###.00" />
                                </p:outputLabel>
                                <f:facet name="footer" >
                                    <p:outputLabel value="#{channelReportController.totalRefund}" >
                                        <f:convertNumber parent="#,##,###.00" />
                                    </p:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column style="text-align: right;" >
                                <f:facet name="header" >
                                    <p:outputLabel value="Net Total" />
                                </f:facet>
                                <p:outputLabel value="#{s.value1+(s.value2+s.value3)}" >
                                    <f:convertNumber parent="#,##,###.00" />
                                </p:outputLabel>
                                <f:facet name="footer" >
                                    <p:outputLabel value="#{channelReportController.totalBilled+channelReportController.totalCancel+channelReportController.totalRefund}" >
                                        <f:convertNumber parent="#,##,###.00" />
                                    </p:outputLabel>
                                </f:facet>
                            </p:column>
                            
                                <f:facet name="footer" >
                                    <h:outputLabel value="#{sessionController.loggedUser.webUserPerson.name}" style="float: right"/>
                                </f:facet>
                        </p:dataTable>
                    </p:panel>
                </p:panel>
                <p:commandButton ajax="false" value="Check" action="#{channelReportController.updateChannel()}"  rendered="false"/>

            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
